start = Time.now
require 'ephemeris/ephemeris.rb'
require 'elements.rb'
require "integrators/body.rb"

require "integrators/vector.rb"

# creating initial conditions
b = Body.new
b.simple_read
if (CONFIG['debug'])
  b.pp
end

start_time = CONFIG['integration']['start_time']
stop_time  = CONFIG['integration']['stop_time']
step       = CONFIG['integration']['step'].to_f  
method     = CONFIG['integration']['integrator']  

eph = Ephemeris.new;        
$planets = Ephemeris.recountPlanetsArray(start_time)

# Initialize initial datas
eps = 0

# find datas
b.evolve(method, step, start_time, stop_time)

#diff = (b.pos - $planets[3][stop_time][0])
#dist = diff.module

# find distance between object and Earth                                                        
if (CONFIG['debug'])
  b.pp
  puts "Script time: #{Time.now - start} seconds"
end